package com.plugins.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Environment;
import android.util.Log;


import com.plugins.App;

import java.io.File;
/**
 * 文件处理
 *
 */
public class FileUtil {
    private static final String TAG = "FileUtil";
    private static String storagePath = null;


    public static String getPath(){
        if(storagePath==null){
            storagePath = App.getApp().getFilesDir().getAbsolutePath();
        }
        return storagePath;
    }


    /**
     * 删除文件
     * @param path
     * @return
     */
    public static boolean removeFile(String path){
        if(path!=null){
            File file = new File(path);
            if(file.exists()){
                return file.delete();
            }
        }
        return false;
    }



    /**
     * 判断文件是否存在
     * @param path
     * @return
     */
    public static boolean checkFileExists(String path){
        if(path==null){
            return false;
        }
        File file = new File(path);
        return file.exists();
    }
}
